package com.hopu.v1.controller.admin.system;

import com.hopu.v1.pojo.common.R;
import com.hopu.v1.pojo.system.StaffSubject;
import com.hopu.v1.service.admin.system.StaffSubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/staffSubject")
public class StaffSubjectController {
    @Autowired
    private StaffSubjectService staffSubjectService;

    @PostMapping("/insert")
    public R insert( StaffSubject staffSubject) {
        return R.ok(this.staffSubjectService.save(staffSubject));
    }

    @PutMapping("/update")
    public R update(StaffSubject staffSubject) {
        return R.ok(this.staffSubjectService.updateById(staffSubject));
    }

    @GetMapping("updateStaffSubject")
    public R updateSubjectName(@RequestParam("empId") Integer empId, @RequestParam("subjectIdList") List<Integer> subjectIdList) {
        System.out.println(empId);
        System.out.println(subjectIdList);
        this.staffSubjectService.updateSubjectName(empId, subjectIdList);
        return R.ok("修改成功");
    }

}


